<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<body>
    <nav th:fragment="nav" class="navbar navbar-default">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <a class="navbar-brand" href="/">梦蝶社区</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <form class="navbar-form navbar-left">
                <div class="form-group">
                    <input type="text" class="form-control" placeholder="搜索问题">
                </div>
                <button type="submit" class="btn btn-default">提交</button>
            </form>
            <ul class="nav navbar-nav navbar-right">
                <li th:if="${session.user!=null}" class="dropdown"><a href="/publish">发布</a></li>
                <li th:if="${session.user==null}"><a
                        href="https://gitee.com/oauth/authorize?client_id=c00be61bf0a58d91f6bfc3c5d34dd878148f120c93f1ea07c8bf0aac706debce&redirect_uri=http://localhost:8889/callback&response_type=code">登录</a>
                </li>
                <li class="dropdown" th:if="${session.user!=null}">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
                       aria-expanded="false">[[${session.user.name}]]<span class="caret"></span></a>
                    <ul class="dropdown-menu">
                        <li><a th:href="@{/personal/mypublish/{page}(page=1)}">我的问题</a></li>
                        <li><a th:href="@{/personal/replies/{page}(page=1)}">最新回复</a></li>
                        <li><a th:href="@{/logout}">退出登录</a></li>
                    </ul>
            </ul>
        </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
</nav>
</body>
</html>